package com.my.controller;


import com.my.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@CrossOrigin("*")
@RequestMapping("/person")
public class PersonController {

    PersonService personService;

    @Autowired
    public void setPersonService(PersonService personService) {
        this.personService = personService;
    }

    @RequestMapping("/show")
    public String showPerson(HttpServletRequest req) {
        return this.personService.showPerson(req);
    }


    @RequestMapping("/update")
    public String updatePerson(String name, String birth, String sex, HttpServletRequest req) {
        return this.personService.updatePerson(name, birth, sex, req);
    }

}
